// 服务器全部接口相同返回的数据类型
export interface ResponseData {
    code: number,
    message: string,
    ok: boolean
}

// 每一个SPU对象数据的ts类型
export interface SpuData {
    category3Id: number,
    id?: number,
    spuName: string,
    tmId: number | string,
    description: string,
    spuImageList: null | SpuImg[],
    spuSaleAttrList: null | SaleAttr[],
}

// 存储每个spu对象的数组类型
export type Records = SpuData[]

// 定义获取已有SPU接口返回的数据类型
export interface HasSpuResponseData extends ResponseData {
    data: {
        records: Records,
        total: number,
        size: number,
        current: number,
        searchCount: boolean,
        pages: number
    }
}


// 获取品牌名称单个对象的数据ts
export interface TradeMark {
    id: number,
    tmName: string,
    logoUrl: string
}

// 全部品牌数据返回数据类型
export interface AllTrademark extends ResponseData {
    data: TradeMark[]
}
// 
// spu图片单个对象数据类型
export interface SpuImg {
    id?: number,
    createTime?: string | null,
    updateTime?: string | null,
    spuId?: number,
    imgName?: string,
    imgUrl?: string,
    name?: string,
    url?: string,
    response?: {
        data: string
    }
}

// 返回数据全部图片类型
export interface AllSpuImg extends ResponseData {
    data: SpuImg[]
}
// 
// 已有销售属性对象值ts类型
export interface SaleAttrValue {
    id?: number,
    createTime?: string | null,
    updateTime?: string | null,
    spuId?: number,
    baseSaleAttrId: number | string,
    saleAttrValueName: string,
    saleAttrName?: string,
    isChecked?: string | null
}

// 存储已有属性值数组类型
export type SpuSaleAttrValueList = SaleAttrValue[]

// 销售属性对象
export interface SaleAttr {
    id?: number,
    createTime?: string | null,
    updateTime?: string | null,
    spuId?: number,
    baseSaleAttrId: number | string,
    saleAttrName: string,
    spuSaleAttrValueList: SpuSaleAttrValueList,
    flag?: boolean,
    saleAttrValueName?: string,
    saleIdAndValueId?: string
}

// spu接口已有属性返回类型
export interface SaleAttrResponseData extends ResponseData {
    data: SaleAttr[]
}

// 
// 全部销售属性对象类型
export interface AllSaleAttr {
    id: number,
    name: string
}

// 接口返回全部销售属性类型
export interface AllSaleAttrResponseData extends ResponseData {
    data: AllSaleAttr[]
}


export interface Attr {
    attrId: string | number,
    valueId: string | number,
}

export interface saleAttr {
    saleAttrId: string | number,
    saleAttrValueId: string | number,
}
// 添加sku参数data类型
export interface SkuData {
    category3Id: string | number,
    spuId: string | number,
    tmId: string | number, // 品牌id
    skuName: string,
    price: string | number,
    weight: string | number,
    skuDesc: string,
    skuAttrValueList: Attr[],
    skuSaleAttrValueList: saleAttr[], // 销售属性
    skuDefaultImg: string
}

// 获取sku数据接口的ts类型
export interface SkuInfoData extends ResponseData {
    data: SkuData[]
}